<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class AppParser extends CI_Parser {

	function module_parse($template, $data, $return = FALSE){
		$CI =& get_instance();

		$template = $CI->load->module_view($template, $data, TRUE);
		if ($template == ''){
			return FALSE;
		}

		foreach ($data as $key => $val){
			if (is_array($val)){
				$template = $this->_parse_pair($key, $val, $template);		
			}else{
				@$template = $this->_parse_single($key, (string)$val, $template);
			}
		}

		if ($return == FALSE){
			$CI->output->append_output($template);
		}

		return $template;
	}
}